package com.gticket.buyticket.mapper;

import com.gticket.buyticket.pojo.Movie;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface MovieInfoMapper {

    //遍历所有的电影显示在全部电影页面
    //只显示图片与名字即可
    @Select("select movie_id,movie_name,movie_detail from ${database}.movies")
    public List<Movie> getAllMovies();

    //根据电影id查询电影信息｛电影详情页面｝
    @Select("select * from ${database}.movies where movie_id=#{movie_id}")
    public Movie getAllByMovieId(Movie movie);

    //搜索电影，根据电影名
    @Select("select * from ${database}.movies where movie_name like CONCAT('%',#{movie_name},'%') ")
    public List<Movie> searchAllMovies(Movie movie_name);

    //搜索出电影的数量
    @Select("select count(*) from ${database}.movies where movie_name like CONCAT('%',#{movie_name},'%') ")
    public int searchMoviesNumber(Movie movie_name);
}
